package sk.naive.talker.command;

import sk.naive.talker.util.Buffer;
import sk.naive.talker.*;

/**
 * LocationHelper.
 *
 * @author <a href="mailto:virgo@naive.deepblue.sk">Richard "Virgo" Richter</a>
 * @version $Revision: 1.3 $ $Date: 2004/10/04 21:58:01 $
 */
public class LocationHelper {
	private CommandDispatcher commandDispatcher;

	public LocationHelper(CommandDispatcher commandDispatcher) {
		this.commandDispatcher = commandDispatcher;
	}

	// TODO nedalo by sa to bez toho commandu?
	protected Buffer locationBufferForUser(AbstractCommand command) throws CommandException {
		return command.getBuffer(locationFinder().findLocationForUser(command.user), Review.TPROP_SAY_REVIEW);
	}

	public Location locationForUser(User u) {
		return locationFinder().findLocationForUser(u);
	}

	public Location locationForName(String name) {
		return locationFinder().findLocationByName(name);
	}

	private LocationFinder locationFinder() {
		return commandDispatcher.locationFinder();
	}
}
